<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--商户管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/member/css/core1.css?v=1"/>

    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/wangEditor.css"/>

    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/liandong.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/layer/layer.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/laydate/laydate.js"></script>
    <script type="text/javascript" src="/static/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" src="/static/ueditor/1.4.3/ueditor.all.min.js"></script>
    <script type="text/javascript" src="/static/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
    <style>
        .filePicker{
            margin-top: -5px;
            width: 110px;
            height: 37px;
            background: #00A2D4;
            color: #fff;
            text-align: center;
            line-height:37px;
            border-radius: 4px;
            cursor: pointer;
        }
        .file{
            position: absolute;
            left: 0px;
            top: -5px;
            width: 110px;
            height: 37px;
            line-height: 37px;
            opacity: 0;
            cursor: pointer;
        }
        .img-file{
            width: 100px;
            height: 100px;
            display: block;
            margin-left: 26px;
            margin-top: 10px;
            display: none;
        }
        .form-control{
            width: 50%;
        }
        .has-switch span, .has-switch label{
            height: auto;
        }
        .table-bordered>tbody>tr>td{
            padding-left: 32px;
        }
        .ng-scope input {
            width: 82px;
            height: 34px;
            position: absolute;
            left: 0;
            top: 10px;
            opacity: 0;
            cursor: pointer;
        }
        .img{
            width:300px;
        }
        .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] {
            position: absolute;
            margin-left: -6px;
            margin-top: -19px;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgr15 mgl15">
            <ul class="breadcrumb">
                <li>当前位置是：</li>
                <li><a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡</a></li>
                <li><a href="{:url('shop/shopmall',['card_id'=>$card['card_id']])}"> 积分商城</a></li>
                <li><a href="javascript:history.back();">商品列表</a></li>
                <li class="active" style="color: #02b87f;">商品修改</li>
            </ul>
        </div>
        <div class="panel mgr15 mgl15">
            <div class="panel-heading addCharts" style="background:#ededed;">
                修改商品
            </div>
            <div class="panel-body">
                <form class="form-horizontal adminex-form" action="" method="post">

                    <div class="panel panel-default" id="step1">
                        <div class="panel-body">

                            <div class="pull-left alert form form-area col-sm-12 col-md-12 " style="display: block; margin-top: 0.5px;">
                                <div class="arrow_in"></div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品名称：</label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <input type="text" class="form-control" readonly onclick="return layer.msg('商品名称不能修改')" value="{$info.goods_name}">
                                    </div>
                                </div>
                                <div class="form-group jifenshezhi">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">需要积分：</label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <input type="text" class="form-control" name="goods_price" value="{$info.goods_price}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">选择类目：</label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <select name="cate_id" id="cate" class="form-control">
                                            {volist name="catelist" id="vo"}
                                            <option value="{$vo.id}" {if condition="$info['cate_id'] eq $vo.id"}selected{/if}>{$vo.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">库存：</label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <input type="text" class="form-control" name="stock" value="{$info.stock}">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">商品图片：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <img src="{$info.img_url}" alt="商品图片" class="img">
                                        <div class="ng-scope" style="position: relative;">
                                            <span class="btn btn-default">上传图片</span>
                                            <input type="file" id="img" value=""  onchange="upload('img','file')"/>
                                            <input type="hidden" name="img_url" id="logopic-upload" value="{$info.img_url}" class="file-img">

                                        </div>
                                        <div class="r-desc ng-binding ng-scope"> 图片建议尺寸：300像素*300像素，格式为.jpg，大小不超过2M.</div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">商品描述：</label>
                                    <div class="col-sm-9 col-xs-12" id="show_box">
                                        <textarea type="text" name="show" id="editor" style="height:500px;">{$info.show}</textarea>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动时间：</label>
                                    <div class="col-sm-9 col-xs-12">
                                        <input name="search_date" type="text" value="{$info.search_date}"
                                               readonly="readonly" id="search_date" class="form-control"
                                               placeholder="请选择活动时间" style="width: 297px">
                                    </div>
                                </div>

                                <div style="text-align: center">
                                    <button type="button" class="btn btn-primary" id="add">修改</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        {include file='public/footer'/}
    </div>
</section>
<!--获取会员卡列表-->
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header" style="background: #F4F5F9;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">选择会员卡</h4>
            </div>
            <div class="modal-body">
                <div class="panel panel-default panel-modal" style="border: 0;">
                    <div class="panel-heading"
                         style="overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-bottom: 0;">
                        <div class="checkbox pull-left">
                            <label>
                                会员卡名称
                            </label>
                        </div>
                    </div>
                    <div class="panel-body" style="padding: 0;">
                        <table class="table table-bordered">
                            <tbody id="tbody"></tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal-footer"
                 style="text-align: center;overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-top: 0;">
                <button type="button" class="btn btn-success" id="choiceComplate" >完成</button>
            </div>
        </div>
    </div>
</div>
</div>
</body>
<script>
    //执行一个laydate实例
    // var s=laydate.now();
    laydate.render({
        elem: '#search_date',
        type: 'datetime',
        range: true,
        change: function (value, date, date2, data3) {


        }
    });
</script>
<script>
    $(function () {
        var ue = UE.getEditor('editor');
    });
</script>
<script>
    function upload(file, typed) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other', file);
        $.ajax({
            url: "{:url('Uploads/uploadserver')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {

            $("." + file).attr("src", res).css("display", "block");
            $(".file-" + file).val(res);
            $("." + typed + "-" + file).val(res);
        }).fail(function (res) {
            alert("上传失败")
        });
    }
    function addform() {
        $('#addcards').submit();
    };



    $("#add").click(function(){
        var id = $("#card_id").val();
        var goods_name = $("#goods_name").val();
        var goods_price = $("#goods_price").val();
        var kucun = $("#kucun").val();
        var search_date = $("#search_date").val();
        var logopic=$("#logopic-upload").val();
        var type = $("#type").val();
        var money = $("#zs_money").val();
        if(type=="red_money"){
            if(money==""){
                layer.alert("请输入红包金额");
                return false;
            }
        }else{
            if(id == ""){
                layer.alert("请选择卡券");
                return false;
            }
        }
        if(goods_name == ""){
            layer.alert("商品名称不能为空");
            return false;
        }
        if(goods_price == ""){
            layer.alert("积分不能为空");
            return false;
        }
        if(kucun == ""){
            layer.alert("库存不能为空");
            return false;
        }
        if(logopic == ""){
            layer.alert("请上传商品图片");
            return false;
        }
        if(search_date == ""){
            layer.alert("请选择活动时间");
            return false;
        }

        $(".adminex-form").submit();
    });

</script>



</html>
